import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { BookModule } from './book/book.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { DB_PASSWD } from './config';
import { InfoController } from './info/info.controller';
import { CourseModule } from './entry/course/course.module';
import { TextbookModule } from './entry/textbook/textbook.module';
import { NetInfoModule } from './entry/net-info/net-info.module';
import { PoetModule } from './poet/poet.module';

@Module({
  imports: [
    BookModule,
    TypeOrmModule.forRoot({
      type: 'mysql',
      username: 'api3',
      password: DB_PASSWD,
      host: 'hw.masaikk.fun',
      port: 3306,
      database: 'book',
      synchronize: true,
      retryDelay: 500,
      retryAttempts: 10,
      autoLoadEntities: true,
    }),
    CourseModule,
    TextbookModule,
    NetInfoModule,
    PoetModule,
  ],
  controllers: [AppController, InfoController],
  providers: [AppService],
})
export class AppModule {}
